<<<<<<< HEAD
#include "word.h"
#include "lcd.h"
#include <time.h>
unsigned char nums[10][24][2] = {
    /*--  文字:  0  --*/
    /*--  楷体18;  此字体下对应的点阵为：宽x高=12x24   --*/
    /*--  宽度不是8的倍数，现调整为：宽度x高度=16x24  --*/
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x1F,
    0x80,
    0x3F,
    0xC0,
    0x7F,
    0xC0,
    0x71,
    0xE0,
    0xF0,
    0xE0,
    0xF0,
    0xE0,
    0xF0,
    0xE0,
    0xF0,
    0xF0,
    0xE0,
    0xF0,
    0xE0,
    0xE0,
    0xF0,
    0xE0,
    0xF0,
    0xE0,
    0x70,
    0xE0,
    0x79,
    0xE0,
    0x7F,
    0xC0,
    0x3F,
    0xC0,
    0x1F,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,

    /*--  文字:  1  --*/
    /*--  楷体18;  此字体下对应的点阵为：宽x高=12x24   --*/
    /*--  宽度不是8的倍数，现调整为：宽度x高度=16x24  --*/
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x07,
    0x00,
    0x0F,
    0x00,
    0x1F,
    0x00,
    0x3F,
    0x00,
    0x7F,
    0x00,
    0x7F,
    0x00,
    0x0F,
    0x00,
    0x0F,
    0x00,
    0x0F,
    0x00,
    0x0F,
    0x00,
    0x0F,
    0x00,
    0x0F,
    0x00,
    0x0F,
    0x00,
    0x0F,
    0x00,
    0x0F,
    0x00,
    0x0F,
    0x00,
    0x07,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,

    /*--  文字:  2  --*/
    /*--  楷体18;  此字体下对应的点阵为：宽x高=12x24   --*/
    /*--  宽度不是8的倍数，现调整为：宽度x高度=16x24  --*/
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x1F,
    0x80,
    0x3F,
    0xC0,
    0x7B,
    0xE0,
    0xF1,
    0xE0,
    0xE0,
    0xE0,
    0x00,
    0xE0,
    0x01,
    0xE0,
    0x01,
    0xC0,
    0x03,
    0xC0,
    0x07,
    0x80,
    0x0F,
    0x00,
    0x0E,
    0x00,
    0x1E,
    0x00,
    0x3C,
    0x00,
    0x7F,
    0xE0,
    0xFF,
    0xE0,
    0x7F,
    0xE0,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,

    /*--  文字:  3  --*/
    /*--  楷体18;  此字体下对应的点阵为：宽x高=12x24   --*/
    /*--  宽度不是8的倍数，现调整为：宽度x高度=16x24  --*/
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x1F,
    0x80,
    0x3F,
    0xC0,
    0x79,
    0xE0,
    0x70,
    0xE0,
    0x70,
    0xE0,
    0x00,
    0xE0,
    0x01,
    0xC0,
    0x0F,
    0xC0,
    0x0F,
    0xC0,
    0x03,
    0xE0,
    0x00,
    0xE0,
    0x00,
    0xE0,
    0xF0,
    0xE0,
    0xF1,
    0xE0,
    0x7F,
    0xE0,
    0x3F,
    0xC0,
    0x1F,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,

    /*--  文字:  4  --*/
    /*--  楷体18;  此字体下对应的点阵为：宽x高=12x24   --*/
    /*--  宽度不是8的倍数，现调整为：宽度x高度=16x24  --*/
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x01,
    0xC0,
    0x03,
    0xC0,
    0x03,
    0xC0,
    0x07,
    0xC0,
    0x0F,
    0xC0,
    0x0F,
    0xC0,
    0x1D,
    0xC0,
    0x3D,
    0xC0,
    0x79,
    0xC0,
    0x71,
    0xC0,
    0xF1,
    0xC0,
    0xFF,
    0xF0,
    0xFF,
    0xF0,
    0x01,
    0xC0,
    0x01,
    0xC0,
    0x01,
    0xC0,
    0x01,
    0xC0,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,

    /*--  文字:  5  --*/
    /*--  楷体18;  此字体下对应的点阵为：宽x高=12x24   --*/
    /*--  宽度不是8的倍数，现调整为：宽度x高度=16x24  --*/
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x3F,
    0xE0,
    0x3F,
    0xE0,
    0x7F,
    0xC0,
    0x78,
    0x00,
    0x70,
    0x00,
    0x7E,
    0x00,
    0x7F,
    0x80,
    0xFF,
    0xC0,
    0xF1,
    0xE0,
    0x00,
    0xE0,
    0x00,
    0xE0,
    0x00,
    0xE0,
    0xE0,
    0xE0,
    0xE1,
    0xE0,
    0xFB,
    0xC0,
    0x7F,
    0xC0,
    0x3F,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,

    /*--  文字:  6  --*/
    /*--  楷体18;  此字体下对应的点阵为：宽x高=12x24   --*/
    /*--  宽度不是8的倍数，现调整为：宽度x高度=16x24  --*/
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x03,
    0x80,
    0x07,
    0x80,
    0x0F,
    0x00,
    0x0E,
    0x00,
    0x1E,
    0x00,
    0x3C,
    0x00,
    0x3F,
    0xC0,
    0x7F,
    0xE0,
    0x79,
    0xF0,
    0xF0,
    0xF0,
    0xF0,
    0x70,
    0xF0,
    0x70,
    0xF0,
    0xF0,
    0x70,
    0xF0,
    0x79,
    0xE0,
    0x3F,
    0xC0,
    0x1F,
    0x80,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,

    /*--  文字:  7  --*/
    /*--  楷体18;  此字体下对应的点阵为：宽x高=12x24   --*/
    /*--  宽度不是8的倍数，现调整为：宽度x高度=16x24  --*/
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0xFF,
    0xF0,
    0xFF,
    0xF0,
    0x7F,
    0xF0,
    0x00,
    0xE0,
    0x01,
    0xC0,
    0x01,
    0xC0,
    0x03,
    0x80,
    0x03,
    0x80,
    0x07,
    0x00,
    0x07,
    0x00,
    0x0F,
    0x00,
    0x0E,
    0x00,
    0x0E,
    0x00,
    0x1E,
    0x00,
    0x1C,
    0x00,
    0x1C,
    0x00,
    0x1C,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,

    /*--  文字:  8  --*/
    /*--  楷体18;  此字体下对应的点阵为：宽x高=12x24   --*/
    /*--  宽度不是8的倍数，现调整为：宽度x高度=16x24  --*/
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x1F,
    0x80,
    0x3F,
    0xC0,
    0x79,
    0xE0,
    0xF0,
    0xE0,
    0xF0,
    0xE0,
    0x71,
    0xE0,
    0x7B,
    0xC0,
    0x3F,
    0xC0,
    0x7F,
    0xC0,
    0x7B,
    0xE0,
    0xF0,
    0xE0,
    0xE0,
    0xF0,
    0xE0,
    0xF0,
    0xF0,
    0xE0,
    0xFB,
    0xE0,
    0x7F,
    0xC0,
    0x3F,
    0x80,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,

    /*--  文字:  9  --*/
    /*--  楷体18;  此字体下对应的点阵为：宽x高=12x24   --*/
    /*--  宽度不是8的倍数，现调整为：宽度x高度=16x24  --*/
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x1F,
    0x80,
    0x7F,
    0xC0,
    0x7B,
    0xE0,
    0xF1,
    0xE0,
    0xE0,
    0xE0,
    0xE0,
    0xE0,
    0xE0,
    0xE0,
    0xF1,
    0xE0,
    0xFB,
    0xC0,
    0x7F,
    0xC0,
    0x1F,
    0x80,
    0x07,
    0x80,
    0x07,
    0x00,
    0x0F,
    0x00,
    0x0E,
    0x00,
    0x1E,
    0x00,
    0x3C,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,
    0x00,

};
=======
#include "lcd.h"
#include "word.h"
>>>>>>> eb31325907d20d5a534302285990ef0fe18a1039
void show_word(int x0, int y0, int w, int h, unsigned char word[][w / 8], int color)
{
    int i, j, k;
    for (i = 0; i < h; i++)
    {
        for (j = 0; j < w / 8; j++)
        {
            // 解析 word[i][j] 的8个bits位，为1就显示颜色，为0就不显示
            for (k = 7; k >= 0; k--)
            {
                if (word[i][j] & (1 << k))
                {
                    // 画点
                    display_point(j * 8 + (7 - k) + x0, i + y0, color);
                }
            }
        }
    }
}
<<<<<<< HEAD
void show_num(int x0, int y0, int w, int h, int num, int color)
{
    int tmp[100];
    int n = 0;
    do
    {
        tmp[n++] = num%10;
        num/=10;
    } while (num);
    for(int i = n-1;i>=0;i--)
    {
        show_word(x0+(n-1-i)*16, y0, w, h,nums[tmp[i]],color);
    } 
}

void show_time(int x0,int y0)
{
    time_t timer0 = time(NULL);
    struct tm* plocaltime = localtime(&timer0);
    show_num(x0,y0,16,24,plocaltime->tm_year,0x000000);
    show_num(x0 + 35 + 35,y0,16,24,plocaltime->tm_mon,0x000000);
    show_num(x0 + 70 + 35,y0,16,24,plocaltime->tm_mday,0x000000);

    show_num(x0 + 105 + 35,y0,16,24,plocaltime->tm_hour,0x000000);
    show_num(x0 + 140 + 35,y0,16,24,plocaltime->tm_min,0x000000);
    show_num(x0 + 175 + 35,y0,16,24,plocaltime->tm_sec,0x000000);
=======
unsigned char numbers[10][31][16 / 8] = {
    {
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x1F,0xE0,
        0x3F,0xF0,0x3C,0x78,0x78,0x78,0x78,0x78,0x70,0x3C,0xF0,0x3C,0xF0,0x3C,0xF0,0x3C,
        0xF0,0x3C,0xF0,0x3C,0xF0,0x3C,0x70,0x38,0x78,0x78,0x78,0x78,0x3C,0xF0,0x3F,0xF0,
        0x1F,0xE0,0x07,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    },
    {
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0x03,0xC0,
        0x0F,0xC0,0x3F,0xC0,0x3F,0xC0,0x33,0xC0,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x03,0xC0,
        0x03,0xC0,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x03,0xC0,
        0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    },  
    {
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x3F,0xE0,
        0x7F,0xF0,0x78,0xF8,0x60,0x78,0x00,0x78,0x00,0x78,0x00,0x78,0x00,0xF0,0x01,0xF0,
        0x03,0xE0,0x0F,0xC0,0x1F,0x00,0x3E,0x00,0x3C,0x00,0x78,0x00,0x78,0x00,0x7F,0xFC,
        0x7F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

    },  
    {
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x3F,0xE0,
        0x3F,0xF0,0x30,0xF0,0x00,0xF0,0x00,0x70,0x00,0xF0,0x00,0xF0,0x1F,0xE0,0x1F,0xC0,
        0x1F,0xF0,0x00,0xF0,0x00,0x78,0x00,0x78,0x00,0x78,0x00,0x78,0x70,0xF0,0x7F,0xF0,
        0x7F,0xE0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    },  
    {
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x01,0xF0,
        0x01,0xF0,0x03,0xF0,0x03,0xF0,0x07,0xF0,0x0F,0xF0,0x0E,0xF0,0x1E,0xF0,0x3C,0xF0,
        0x78,0xF0,0x78,0xF0,0xFF,0xFC,0xFF,0xFC,0xFF,0xFC,0x00,0xF0,0x00,0xF0,0x00,0xF0,
        0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

    },  
    {
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xF0,0x3F,0xF0,
        0x3F,0xF0,0x3C,0x00,0x3C,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x3F,0xC0,0x3F,0xF0,
        0x01,0xF0,0x00,0x78,0x00,0x78,0x00,0x78,0x00,0x78,0x00,0x78,0x70,0xF0,0x7F,0xF0,
        0x7F,0xE0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    },  
    {
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xF0,0x0F,0xF8,
        0x1F,0xF8,0x1E,0x00,0x3C,0x00,0x38,0x00,0x78,0x00,0x7B,0xC0,0x7F,0xF0,0x7F,0xF8,
        0x7C,0x78,0x78,0x3C,0x78,0x3C,0x78,0x3C,0x78,0x3C,0x78,0x38,0x3C,0x78,0x3F,0xF0,
        0x1F,0xE0,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    },  
    {
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xF8,0x7F,0xFC,
        0x7F,0xF8,0x00,0x78,0x00,0x70,0x00,0xF0,0x00,0xE0,0x01,0xE0,0x01,0xC0,0x03,0xC0,
        0x03,0x80,0x07,0x80,0x07,0x80,0x07,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x1E,0x00,
        0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    },  
    {
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x1F,0xE0,
        0x3F,0xF0,0x3C,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x3C,0xF0,0x1F,0xE0,0x1F,0xE0,
        0x3F,0xF0,0x78,0x78,0x70,0x38,0xF0,0x3C,0xF0,0x3C,0x70,0x38,0x78,0x78,0x3F,0xF0,
        0x1F,0xE0,0x07,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

    },  
    {
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x1F,0xE0,
        0x3F,0xF0,0x78,0xF8,0x78,0x78,0x70,0x78,0xF0,0x38,0xF0,0x3C,0x78,0x7C,0x7C,0xFC,
        0x3F,0xFC,0x1F,0xF8,0x07,0x38,0x00,0x78,0x00,0x78,0x00,0xF0,0x21,0xF0,0x7F,0xE0,
        0x7F,0xC0,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

    },   
};
void show_num(int x0, int y0, int number)
{
    //int num[100];
    // int n = 0;
    // do
    // {
    //     num[n++] = number%10;
    //     number = number/10;
    // } while (number);
    // for(int i = n-1;i>=0;i--)
    // {
    //     show_word(x0, y0, 16, 31, numbers[num[i]],0x000000);
    //     x0 += 18;

    // }
    int num[20] = {0},i = 19;
    while(number)
    {
        num[i] = number % 10;
        i--;
        number /= 10;
    }
    i = 0;
    while(num[i] == 0)i++;
    for( ; i < 20; i++)
    {
        show_word(x0, y0, 16, 31, numbers[num[i]],0x000000);
        x0 += 18;
    }

}
void count_down(int x0, int y0, int number)
{
    while(number--)
    {
        //show_word(x0, y0, 16, 31, number,0x000000);
        show_num(x0,y0,number);
        sleep(1);
        show_a_color(0xffffff);
    }
>>>>>>> eb31325907d20d5a534302285990ef0fe18a1039
}
